<template>
    <div>
        <el-tabs tab-position="left">
            <el-tab-pane label="api版本和更新历史">
                <br><span style="font-size: 20px">api版本：{{versionStr}}</span><br><br>
                <br><span style="font-size: 32px">更新历史</span><br>
                <span style="font-size: 12px" >最近更新时间： {{versionStr}}</span><br><br>
                <span style="font-size: 20px"><b>第一次发布</b></span><br><br>
                <span style="font-size: 16px" >发布时间：2024-08-27 15:30:22</span><br><br>
                <span style="font-size: 16px" >本次发布新增以下内容：</span><br><br>
                <span style="font-size: 16px" >新增接口：send_command</span><br><br>
                <span style="font-size: 16px" >新增 send_command 接口相关数据结构</span><br><br>

            </el-tab-pane>
            <el-tab-pane label="设备配置命令概览">
                <br><span style="font-size: 32px">设备配置命令概览</span><br>
                <span style="font-size: 12px" >最近更新时间： {{versionStr}}</span><br><br>
                <span style="font-size: 16px" >您可以通过接口向设备发送以下配置命令</span><br><br>
                <el-table :data="commandInfoList" stripe border>
                    <el-table-column  prop="command" label="命令类型" width="200px" align="center"></el-table-column>
                    <el-table-column  prop="name" label="命令名称" width="400px" align="center"></el-table-column>
                </el-table>

            </el-tab-pane>
            <el-tab-pane label="下发配置相关接口">
                <br><span style="font-size: 32px">向设备发送配置命令接口</span><br>
                <span style="font-size: 12px" >最近更新时间： {{versionStr}}</span><br><br>
                <span style="font-size: 20px"><b>1、接口描述</b></span><br><br>
                <span style="font-size: 20px">端口号：</span><span style="font-size: 20px; color: #30633A">9520</span><br>
                <span style="font-size: 20px">接口路径：</span><span style="font-size: 20px; color: #30633A">/alm/api/send_command</span><br><br>
                <span style="font-size: 16px" >本接口用于向设备发送各种配置指令，如：设备上传间隔、继电器通断、过载条件配置等。</span><br><br>

                <span style="font-size: 20px"><b>2、输入参数</b></span><br><br>
                <span style="font-size: 16px" >header请求头中需要附带以下信息，否则会触发错误码： 50001</span><br><br>
                <el-table :data="headerinfoList" stripe border>
                    <el-table-column  prop="key" label="键名" width="200px" align="center"></el-table-column>
                    <el-table-column  prop="value" label="内容" width="400px" align="center"></el-table-column>
                </el-table>
                <br><span style="font-size: 16px" >输入参数如下：</span><br><br>
                <el-table :data="paramInfoList" stripe border >
                    <el-table-column  prop="name" label="字段名" width="200px" align="center"></el-table-column>
                    <el-table-column  prop="meaning" label="中文释义" width="400px" align="center"></el-table-column>
                    <el-table-column  prop="type" label="字段类型" width="400px" align="center"></el-table-column>
                    <el-table-column  prop="required" label="是否必填" width="400px" align="center"></el-table-column>
                </el-table>
            </el-tab-pane>


            <el-tab-pane label="错误码">
                <br><span style="font-size: 32px">错误码</span><br>
                <span style="font-size: 12px" >最近更新时间： {{versionStr}}</span><br><br>
                <span style="font-size: 20px"><b>功能说明</b></span><br><br>
                <span style="font-size: 16px" >如果返回结果中 code 字段值不为 200 ，则表示调用 API 接口失败。例如：</span>
                <pre class="test">
                {
                    "code": 50003,
                    "message": "命令类型不正确"
                }</pre>
                <span style="font-size: 16px">code表示响应码，message表示该错误的具体信息。</span><br><br>
                <span style="font-size: 20px"><b>错误码列表</b></span><br><br>
                <el-table :data="errorCodeList" stripe border >
                    <el-table-column  prop="code" label="错误码" width="200px" align="center"></el-table-column>
                    <el-table-column  prop="message" label="错误信息" width="400px" align="center"></el-table-column>
                </el-table>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                versionStr: "2024-08-27 15:30:22",
                commandInfoList: [
                    {
                        command: "RELAYS_ON",
                        name: "继电器开"
                    },
                    {
                        command: "RELAYS_OFF",
                        name: "继电器关"
                    },
                    {
                        command: "RELAYS_ON_AFTER_10S",
                        name: "定时开（10s后）"
                    },
                    {
                        command: "RELAYS_OFF_AFTER_10S",
                        name: "定时关（10s后）"
                    },
                    {
                        command: "UPLOAD_INTERVAL_1S",
                        name: "主动上传间隔1s"
                    },
                    {
                        command: "UPLOAD_INTERVAL_5S",
                        name: "主动上传间隔5s"
                    },
                    {
                        command: "UPLOAD_INTERVAL_10S",
                        name: "主动上传间隔10s"
                    },
                    {
                        command: "UPLOAD_INTERVAL_30S",
                        name: "主动上传间隔30s"
                    },
                    {
                        command: "EXCEPTION_CONDITION",
                        name: "设置异常条件(电流电压功率为多少时视为异常)"
                    },
                ],
                paramInfoList: [
                    {
                        name: "devMac",
                        meaning: "设备mac",
                        type: "String",
                        required: "必填"
                    },
                    {
                        name: "commandType",
                        meaning: "命令类型",
                        type: "String",
                        required: "必填"
                    },
                    {
                        name: "voltageMaximums",
                        meaning: "电压上限（V)",
                        type: "Integer",
                        required: "若 commandType 为 EXCEPTION_CONDITION 则除了 设备mac 和命令类型以外，剩余6个字段应至少一个不为空"
                    },
                    {
                        name: "voltageMinimums",
                        meaning: "电压下限（V)",
                        type: "Integer",
                        required: ""
                    },
                    {
                        name: "currentMaximums",
                        meaning: "电流上限（A）",
                        type: "Integer",
                        required: ""
                    },
                    {
                        name: "currentMinimums",
                        meaning: "电流下限（A）",
                        type: "Integer",
                        required: ""
                    },
                    {
                        name: "powerMaximums",
                        meaning: "功率上限（W)",
                        type: "Integer",
                        required: ""
                    },
                    {
                        name: "powerMinimums",
                        meaning: "功率下限（W）",
                        type: "Integer",
                        required: ""
                    },
                ],
                headerinfoList: [
                    {
                        key: "alm",
                        value: "ALM_DEVICE"
                    }
                ],
                errorCodeList: [
                    {
                        code: 50001,
                        message: "认证失败"
                    },
                    {
                        code: 50002,
                        message: "设备mac地址为空"
                    },
                    {
                        code: 50003,
                        message: "命令类型不正确"
                    },
                    {
                        code: 50004,
                        message: "需要设置的条件应至少有一个不为空"
                    },
                    {
                        code: 50010,
                        message: "电流阈值设置不正确"
                    },
                    {
                        code: 50011,
                        message: "电流上下限设置不能为负数"
                    },
                    {
                        code: 50012,
                        message: "电压阈值设置不正确"
                    },
                    {
                        code: 50013,
                        message: "电压上下限设置不能为负数"
                    },
                    {
                        code: 50014,
                        message: "功率上下限设置不能为负数"
                    },
                    {
                        code: 50015,
                        message: "功率阈值设置不正确"
                    },
                    {
                        code: 50020,
                        message: "电流上限最大为60A"
                    },
                    {
                        code: 50021,
                        message: "电压上限最大为600V"
                    },
                    {
                        code: 50022,
                        message: "功率上限最大为3600W"
                    },
                ]
            };
        }
    };
</script>
<style>
    pre.test {
        background-color: #2C2C2C;
        color: #ffffff;
        font-size: 16px;
    }
</style>